package com.dayuanit.dy17.mix.aop.aspect;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Order(1)//值越小 优先级越高 就越先执行
public class ServiceHelloAspect {

    //切点：告诉AOP哪些类、哪些方法需要被代理
    @Pointcut("execution(* com.dayuanit.dy17.mix.aop.service.impl.*.*(..))")
    public void pointCut() {

    }

    @Before("pointCut()")
    public void doBefore() {
        System.out.println("hello...");
    }

    @After("pointCut()")
    public void doAfter() {
        System.out.println("bye...");
    }

}
